import { createElement, HTMLAttributes, type FC } from 'react';
import classNames from 'classnames';

import { itemDescriptionDefaultProps } from './defaultProps';
import type { ItemDescriptionOptions } from './type';

export interface ItemDescriptionProps extends ItemDescriptionOptions, HTMLAttributes<HTMLDivElement> {}

const ItemDescription: FC<ItemDescriptionProps> = (props) => {
  const { className, children, forwardedRef, ...itemDescriptionProps } = props;

  return createElement(
    'div',
    { ref: forwardedRef, className: classNames('description', className), ...itemDescriptionProps },
    children,
  );
};

ItemDescription.displayName = 'ItemDescription';
ItemDescription.defaultProps = itemDescriptionDefaultProps;

export default ItemDescription;
